/*******************************************************************************
 * Copyright 2011 Mauro Luigi Drago (drago.luigi@gmail.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/
package com.bytenose.extrautils.functional;

import com.bytenose.extrautils.annotations.Immutable;

/**
 * A 3-arity materialized tuple.
 * @author Mauro Luigi Drago
 *
 * @param <A1> the type of the first value.
 * @param <A2> the type of the second value.
 * @param <A3> the type of the third value.
 */
@Immutable
public final class Tuple3<A1, A2, A3> implements ITuple3<A1, A2, A3>{
	private final A1 value1;
	private final A2 value2;
	private final A3 value3;
	
	/**
	 * Creates a new {@link Tuple2}
	 * @param value1 the first value.
	 * @param value2 the second value.
	 * @param value3 the third value.
	 */
	public Tuple3(A1 value1, A2 value2, A3 value3) {
		this.value1 = value1;
		this.value2 = value2;
		this.value3 = value3;
	}
	
	@Override
	public A1 getValue1() {
		return value1;
	}
	
	@Override
	public A2 getValue2() {
		return value2;
	}
	
	@Override
	public A3 getValue3() {
		return value3;
	}
	
	/**
	 * Creates a new {@link Tuple2}
	 * @param <T1> the type of the first value.
	 * @param <T2> the type of the second value.
	 * @param <T3> the type of the third value.
	 * @param value1 the first value.
	 * @param value2 the second value.
	 * @param value3 the third value.
	 */
	public static <T1,T2,T3> Tuple3<T1,T2,T3> create(T1 value1, T2 value2,
			T3 value3) {
		return new Tuple3<T1,T2,T3>(value1, value2, value3);
	}
	
	@Override
	public Tuple3<A1, A2, A3> materialize() {
		return this;
	}
}
